package com.eop.managedBean;

import javax.faces.context.FacesContext;

import org.operamasks.faces.annotation.Accessible;
import org.operamasks.faces.annotation.BeforeRender;
import org.operamasks.faces.annotation.Inject;
import org.operamasks.faces.annotation.ManagedBean;
import org.operamasks.faces.annotation.ManagedBeanScope;
import org.operamasks.faces.annotation.SaveState;

@ManagedBean(name = "eop_showEventBean", scope = ManagedBeanScope.REQUEST)
public class ShowEventBean extends BaseEventBean {
	@Inject
	private FacesContext context;

	@Accessible
	@SaveState
	private String id = FacesContext.getCurrentInstance().getExternalContext()
			.getRequestParameterMap().get("id");

	@BeforeRender
	public void beforeRender(boolean isPostback) {
		if (!isPostback) {
			if (null != id && !"".equals(id)) {
				event = eventService.getEventById(id);
				if (event != null)
					this.getEventProperty(event);
			}
		}
	}
}
